#include <STC89C5xRC.H>
#include "Delay.h"
#include "Timer0.h"

sbit Buzzer=P2^5;
unsigned int FreqTable[]={63777,63872,63969,64054,64140,64216,64291,64360,64426,64489,
64547,64603,64655,64704,64751,64795,64837,64876,64913,64948,64981,65012,65042,
65070,65095,65120,65144,65166,65186,65206,65225,65242,65259,65274,65289,65303
};

unsigned char FreqSelect;
void main()
{	
	Timer0_Init();
	while(1)
	{
		Delay(500);
		FreqSelect++;
	}
}

//void toune(unsigned char )

void Timer0_Routine() interrupt 1//定时器0对应的interrupt 1，为其对应的中断函数
{	
	static unsigned int T0Count; //静态局部变量，保证退出函数时不丢失
	TL0 = FreqTable[FreqSelect]%256;
	TH0 = FreqTable[FreqSelect]/256;
	Buzzer=!Buzzer;
}